using System;
using Microsoft.Practices.ObjectBuilder;
using Microsoft.Practices.CompositeUI;
using Jbe.TestSuite.Infrastructure.Interface;
using Microsoft.Practices.EnterpriseLibrary.Logging;
using Jbe.TestSuite.Infrastructure.Interface.Services;

namespace Jbe.TestSuite.LogViewer.Demo
{
    public class LogDemoPresenter : Presenter<ILogDemo>
    {
        /// <summary>
        /// This method is a placeholder that will be called by the view when it's been loaded <see cref="System.Winforms.Control.OnLoad"/>
        /// </summary>
        public override void OnViewReady()
        {
            base.OnViewReady();
        }

        /// <summary>
        /// Close the view
        /// </summary>
        public void OnCloseView()
        {
            base.CloseView();
        }

        public void Log()
        {
            LogEntry logEntry = (LogEntry)View.LogEntry.Clone();
            logEntry.TimeStamp = DateTime.Now;
            Logger.Write(logEntry);
        }
    }
}

